import React from "react";
import { useSelector, useDispatch } from "react-redux";

const Child2 = () => {
  const count = useSelector((state) => state.count);
  const name = useSelector((state) => state.name);
  const dispatch = useDispatch();

  return (
    <div>
      child2组件 - {count} - {name} -{" "}
      <button onClick={() => dispatch({ type: "increment", n: 10 })}>
        count + 10
      </button>
    </div>
  );
};

export default Child2;
